package com.jinzecloud.fiction.controller;

import com.jinzecloud.fiction.annotation.TestAnnotation;
import com.jinzecloud.fiction.bean.TbAdmin;
import com.jinzecloud.fiction.utils.R;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {

    @TestAnnotation("执行了测试Controller")
    @GetMapping("/test")
    public R<?> test() {
        return R.ok("test");
    }

    @TestAnnotation("保存了xxx数据")
    @GetMapping("/testArgs")
    @Transactional
    public R<?> testArgs(@RequestBody(required = false) TbAdmin admin) {
        System.out.println("===========================");
        // http获取数据
        // 获取不到数据
        try {
            int i = 0;
            int y = 1 / i;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return R.ok();
    }

}
